#ifndef ClientRiotShield_H
#define ClientRiotShield_H

#include "RiotShield.h"
#include "Engine.h"
#include "InputSet.h"
#include "MotionState.h"
#include <OgreEntity.h>
#include "PlayingFieldConstants.h"
#include "NetworkTarget.h"
#include "NetworkUtils.h"

//a riot shield for the player to control
class ClientRiotShield : public RiotShield, public NetworkTarget {
public:
	ClientRiotShield(char* name, Ogre::SceneManager* sm, Ogre::SceneNode* toAddTo, int ID) : RiotShield(name, sm, toAddTo, 1){
		updated = 0;
		xloc = myPos.x;
		yloc = myPos.y;
		zloc = myPos.z;
		vx = myPos.vx;
		vy = myPos.vy;
		vz = myPos.vz;
		pthread_mutex_init(&shieldLock, NULL);
		myID = ID;
	}
	virtual void runLogic();
	virtual void messageUpdate(char *message, int length);
protected:
	//used for client side calculations
	bool updated;
	double xloc;
	double yloc;
	double zloc;
	double vx;
	double vy;
	double vz;
	//used to synchronize access to the above members
	pthread_mutex_t shieldLock;
	Converter conv;
	int myID;
};

#endif
